package com.icoo.order.order.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.icoo.base.enums.CustomerEnum;
import com.icoo.base.model.ResultModel;
import com.icoo.order.order.model.OrderVo;
import com.icoo.order.order.po.Product;
import com.icoo.order.order.service.OrderService;
import com.icoo.order.order.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/order")
@Api("订单")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/createOrder")
    @Operation(summary = "下单")
    public ResultModel createOrder(@Valid @RequestBody OrderVo orderVos){
        List<OrderVo> list = new ArrayList<>();
        list.add(orderVos);
        orderService.createOrder(list);
        return ResultModel.success();
    }

    @PostMapping("/feignTest")
    @Operation(summary = "测试feign")
    public ResultModel feignTest(){
        System.out.println("1111");
        return ResultModel.success();
    }
}
